In general, a digital computer performs tasks defined by a list of internally stored instructions. The list of instructions or computer codes, which is referred to as a program, is stored in the computer's main memory. To perform a given computational task, the central processing unit or processor of the digital computer fetches individual instructions of the program for execution. A program counter within the computer points to the next instruction to be executed.
The length of the instruction or instruction word depends on the specific computer design. FIG. 1 shows a typical instruction word 101. The instruction word includes an opcode field 110 and one or more operand fields 115, depending on the instruction. The opcode defines the operation and the operand or operands may contain data that are to be operated by the given instruction.
Various types of computer architectures exist, such as Von-Neumann and the Harvard Architectures. See generally Hennessy and Pallerson, Computer Architecture: A Quantitative Approach (1996), which is herein incorporated by reference for all purposes. In the Von-Neumann Architecture, both data and instructions are transmitted between the processor and memory by a bi-directional bus. As such, the instruction stream includes both data and instructions. In contrast, instructions and data are transmitted on separate buses in the Harvard Architecture, separating the data from the instruction stream.
An instruction requiring an operand that is a constant known at compile time is referred to as an immediate instruction. The known operand is referred to as an immediate data. Immediate data often results in situations where an instruction is operating on a constant or where the operand is an address pointer.
In all current processors, regardless of the architecture, immediate data is included as part of the instruction word (stored in the operand field 115 of the instruction word). That is, the immediate data is part of the instruction stream. In some instances, the length of the immediate data can exceed the length of the operand field of the instruction word. Immediate data which exceeds the length of the operand field is typically referred to as a long immediate data. To accommodate the long immediate data, an extension 220 is provided in the instruction word 101, as shown in FIG. 2. The instruction extension is essentially an instruction word containing the immediate data that follows the instruction word 101. As such, an additional cycle is required to handle the extension of a long immediate data.
The presence of extensions can complicate decoding and pipelining issues. To avoid extensions, either constraints are imposed to limit the length of immediate data or the instruction word comprises an operand field having a sufficient length to handle the widest possible immediate data. In the first case, imposing constraints on the length of immediate data may not be desirable due to application requirements. For example, in digital signal processing (DSP) applications, the length of the immediate data is often governed by domain characteristics such as signal-to-noise (SNR) requirements. Likewise, increasing the length of the instruction word to handle the long immediate data may be undesirable as this leads to inefficient use of memory, particularly with embedded systems where chip size is a major concern.
As evidenced by the foregoing discussion, it is desirable to improve coding efficiency without imposing constraints on the length immediate data.